package cn.iocoder.yudao.module.trade.controller.admin.orderpostback;

import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.trade.service.drainage.VivoDrainageServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;

@Tag(name = "管理后台 - ")
@RestController
@RequestMapping("/trade/third-auth")
public class TradeThirdAuthController {

    @Resource
    private VivoDrainageServiceImpl vivoDrainageService;

    @Operation(summary = "vivo鉴权code回传")
    @GetMapping("/vivo")
    @PermitAll
    @TenantIgnore
    public void authCode(String code, String state) {
        vivoDrainageService.cacheToken(code);
    }

    @Operation(summary = "vivo鉴权code回传")
    @GetMapping("vivo-code-url")
    @PermitAll
    @TenantIgnore
    public String vivoUrl() {
        return vivoDrainageService.cacheAccessToken();
    }
}
